#include <iostream>
#include <cmath>
#include <cstring>
#define MAXN 1000000
using namespace std;
int n;

// bool is_prime(int n) {
//     if (n == 1) return false;
//     for (int i = 2; i * i <= n; i++) {
//         if (n % i == 0) return false;
//     }
//     return true;
// }
int prime[MAXN];
bool is_prime[MAXN];
int sieve(int x) {
    int p = 0;
    fill(is_prime, is_prime + x, true);
    is_prime[0] = is_prime[1] = false;
    for (int i = 2; i <= x; i++) {
        if (is_prime[i]) {
            prime[p++] = i;
            for (int j = i * 2; j <= x; j += i) is_prime[j] = false;
        }
    }
    return p;
}

void solve();
int main() {
    sieve(MAXN - 1);
    while (cin >> n) {
        solve();
    }
}

void solve() {
    int res = 0;
    for (int i = 0; i <= n; i++) {
        res += is_prime[i];
    }
    cout << res << endl;
}
/*
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <vector>
using namespace std;

const int maxn = 1E6+10;
bool isp[maxn];
vector<int> prime;
void getprime(int n)//欧拉筛
{
    memset(isp, 1, sizeof isp);
    for(int i = 2; i <= n; ++i)
    {
        if(isp[i])
            prime.push_back(i);
        for(int j = 0; i * prime[j] <= n; ++j)
        {
            isp[i * prime[j]] = 0;
            if(i % prime[j] == 0)
                break;
        }
    }
}

int main()
{
    getprime(1000000);
    int n;
    while(scanf("%d", &n) != EOF)
    {
        int ans = upper_bound(prime.begin(), prime.end(), n) - prime.begin();
        cout << ans << endl;
    }
    return 0;
}
*/

int seive(int x) {
    int sum = 0;
    for (int i = 0; i <= x; i++) is_prime[i] = true;
    is_prime[0] = is_prime[1] = false;
    for (int i = 2; i <= x; i++) {
        if (!is_prime[i]) continue;
        for (int j = i + i; j <= x; j += i) 
            is_prime[j] = false;
        sum++;
    }
    return sum;
}
